﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace FlightSearchServer
{
    [ServiceContract]
    public interface IFlightSearchServiceClients
    {
        [WebGet(UriTemplate = "tickets?date={date}&src={source}&dst={destination}" )]
        [OperationContract]
        TicketList SearchTickets(string date, string source, string destination);

        [WebInvoke(Method="POST", BodyStyle=WebMessageBodyStyle.Wrapped, UriTemplate = "reservations/{seller}")]
        [OperationContract]
        string CreateReservation(string seller, string flight, string date);

        [WebInvoke(Method = "DELETE", UriTemplate = "reservations/{seller}/{id}")]
        [OperationContract]
        void CancelReservation(string seller, string id);
    }

    [DataContract]
    public class Ticket
    {

        [DataMember]
        public Uri Id { get; set; }

        [DataMember]
        public String Company { get; set; }

        [DataMember]
        public String Date { get; set; }

        [DataMember]
        public String Flight { get; set; }

        [DataMember]
        public String Seats { get; set; }

        [DataMember]
        public String Price { get; set; }


    }

    [CollectionDataContract]
    public class TicketList : List<Ticket>
    {   
        public TicketList(){}
        public TicketList(List<Ticket> tickets) : base(tickets) {}
    }
}


